<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');?>
<div class="mainBody">
    <div class="btnArea floatFix">
    	<div class="leftBtn" onclick="javascript:location.href='<?php echo backend_url('app/new_chcode/'.$app['app_id']).'/'.$cur_os; ?>'">
            <div class="absolute">
	            <div class="btnIcon addIcon"></div>
	            <p class="btnName fontDinproMedium">添加一个渠道</p>
			</div>
        </div>
        <div class="selectorDiv btnAreaFix">
            <div class="selectorName fontDinpro">OS</div>
            <div class="locationGroup listGroupDown listGroup">
                <a class="btnLeft btnPrimary fontDinpro" data-toggle="dropdown" href="javascript:void(0)" link="">
                    <?php
                            echo $os[$cur_os];
                    ?>
                </a>
                <a class="btnRight btnPrimary" data-toggle="dropdown" href="javascript:void(0)"><span class="caretBottom"></span></a>
                <ul class="dropDownList fontDinpro">

                    <?php foreach($os as $k=>$r): ?>
                        <li>
                            <a href="javascript:void(0)" class="fontDinpro" link="<?php echo backend_url($language.'/app/chcode_list/'.$app['app_id']); ?>/<?php echo $k; ?>">
                                <?php echo $r; ?>
                            </a>
                        </li>
                    <?php endforeach; ?>
                </ul>
            </div>
        </div>
    </div>
    <div class="tableContent">
        <table class="fontDinpro">
            <thead>
            <tr>
				<th style="width: 120px;">App Id</th>
				<th>App Name</th>
                <th style="width: 100px;">Channel Code</th>
                <th style="width: 120px;">Channel Name</th>
                <th style="width: 80px">OS</th>
                <th style="width: 120px;">Params</th>
                <th style="width: 80px;">Options</th>
            </tr>
            </thead>
            <tbody>
            <tr>
				<td style="width: 120px;">App Id</td>
				<td>App Name</td>
                <td style="width: 100px;">Channel Code</td>
                <td style="width: 120px;">Channel Name</td>
                <td style="width: 80px">OS</td>
                <td style="width: 120px;">Params</td>
                <td style="width: 80px;">Options</td>
            </tr>
            <?php foreach($list as $v) : ?>
                <tr class="lowTr">
	                <td><?php echo $app['app_id']; ?></td>
	                <td><?php echo $app['name']; ?></td>
                    <td><?php echo $v; ?></td>
                    <td><?php echo $chcode_names[$v]; ?></td>
                    <td>
                        <?php
                        $className = '';
                        switch($os[$cur_os]){
                            case "ios":
                                $className = "";
                                break;
                            case "android":
                                $className = "bgAndroidGreen";
                                break;
                            case "wp":
                                $className = "bgBlue";
                                break;
                        }
                        ?>
                        <span class="colorLabel <?php echo $className; ?>"><?php echo $os[$cur_os]; ?></span>
                    </td>
                    <td>
                    	<?php
                    			if(isset($params[$v])){
									echo  sub_utf_string($params[$v],24);
								}else{
									echo '<span class="colorLabel bgBlue">无</span>';
								}
                    	?>
                    </td>
                    <td>
                        <button class="tableBtn" onclick="location.href='<?php echo backend_url($this->language.'/app/new_chcode/'.$app['app_id'].'/'.$cur_os.'/'.$v); ?>'">
                        	<div class="editIcon"></div>Edit
                        </button>
                    </td>
                </tr>
            <?php endforeach; ?>
            <tr style="height: 33px;"></tr>
            </tbody>
        </table>
    </div>
    <div class="changePage"><?php echo $pagination; ?></div>
</div>
